import { createElement, HTMLAttributes, type FC } from 'react';
import classNames from 'classnames';

import { commentTextDefaultProps } from './defaultProps';
import type { CommentTextOptions } from './type';

export interface CommentTextProps extends CommentTextOptions, HTMLAttributes<HTMLDivElement> {}

const CommentText: FC<CommentTextProps> = (props) => {
  const { className, children, forwardedRef, ...commentTextProps } = props;

  return createElement(
    'div',
    { ref: forwardedRef, className: classNames('text', className), ...commentTextProps },
    children,
  );
};

CommentText.displayName = 'CommentText';
CommentText.defaultProps = commentTextDefaultProps;

export default CommentText;
